import { createRouter, createWebHistory } from 'vue-router'
const routes = [
    {
        path: '/',
        redirect: '/home'//重定向
    },
    // home
    {
        path: '/home',
        name: 'home',
        alias: '/root',//路由别名 用于地址栏，/home可以匹配，/root也可以匹配
        meta: {
            name: "首页",
        },
        component: () => import(/* webpackChunkName: 'home' */'../views/Home/Home.vue'),
    },
    // 信息
    {
        path: '/message',
        name: 'message',
        alias: '/message',//路由别名 用于地址栏，/home可以匹配，/root也可以匹配
        meta: {
            name: "信息",
        },
        component: () => import(/* webpackChunkName: 'home' */'../views/Message/Message.vue'),
    },
    // 用户
    {
        path: '/user',
        name: 'user',
        alias: '/user',//路由别名 用于地址栏，/home可以匹配，/root也可以匹配
        meta: {
            name: "个人中心",
        },
        component: () => import(/* webpackChunkName: 'home' */'../views/User/user.vue'),
    },
    // 404页面
    {
        path: '/404',
        name: '404',
        meta: {
            name: "404",
        },
        component: () => import('../views/NotFound.vue')
    },
    // 错误路径
    {
        path: '/:pathMatch(.*)*',//匹配所有路径
        redirect: '/404'
    },

    // 医疗相关页面
    {
        path: '/Medical/app',
        name: 'app',
        meta: {
            name: '就医指南'
        },
        component: () => import('../views/medical/app.vue')
    },
    {
        path: '/Medical/appol',
        name: 'appol',
        meta: {
            name: '1'
        },
        component: () => import('../views/medical/appol.vue')
    },
    {
        path: '/Medical/moder',
        name: 'moder',
        meta: {
            name: '2'
        },
        component: () => import('../views/medical/moder.vue')
    },
    {
        path: '/Medical/sban',
        name: 'sban',
        meta: {
            name: '3'
        },
        component: () => import('../views/medical/sban.vue')
    }

]

const router = createRouter({
    history: createWebHistory(),
    routes
})

export default router


